// var sel_arr = [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }];
// $(".c01-select").select2({
//     data: sel_arr,
//     placeholder:'请选择'
// })
function isToday(year,date,timestemp){
    var _serverDate = year,_date=date,_timestemp = timestemp*1000 || Date.parse(new Date())
    for (var i = 0; i < _date.length; i++) {
        if (!isNaN(_date[i])) {
            _serverDate += _date[i]
        }
    }
    var go_date = new Date(_timestemp)
    var _go_today = String(go_date.getFullYear()) + baseFn.formatDate(go_date.getMonth()+1) + baseFn.formatDate(go_date.getDate())
    if(_serverDate == _go_today){
        return true
    }
    return false;
}
$(".lds-css").css("display", "block")
// 左侧车辆到站流水线
var lis,
    train_flow_id='',//当前列车流程id
    cur_change_mes,//选中数据详情
    set_it,// 定时刷新右侧
    curData='',//当前日期
    curTimeStemp=Date.parse(new Date())/1000
//左侧时间轴
function get_left_list(search_obj) {
    $.ajax({
        url: serverUrl.base+serverUrl.workTaskTrain+"getTrainFlow",
        type: "post",
        dataType:'json',
        data: search_obj,
        beforeSend: function () {
            $(".train_time .lds-css").css("display", "block")
        },
        success: function (data) { 
            if(data.code == 1){
                // alert('请于23：00后进行查询！')
                alert(data.info)
                $(".train_time .lds-css").css("display", "none");
                return false
            }           
            var result = data.data,
                time_arr = result.d,
                cur_year = result.y,//数据年
                cur_mon = result.m,//数据月日
                train_list = result.d,//数据列表
                now_time = result.nowtime || Date.parse(new Date())/1000,//当前服务器时间戳
                time_str = "";
                curTimeStemp = now_time;
            for (var i = 0; i < cur_mon.length; i++) {
                if (isNaN(cur_mon[i])) {
                    time_str += "-" 
                } else {
                    time_str += cur_mon[i]
                }
            }
            $(".train_time .year").html(cur_year)
            $(".train_time .month").html(cur_mon)
            if (train_list.length > 0) {
                $(".train_list li").remove()
            }
            $(".train_list").scrollTop(0)
            var _curids=0;//车次的ids
            $.each(train_list, function (i, val) {
                if ((typeof val) != "string") {
                    // 控制point
                    var train_job_time = cur_year + "-" + time_str.substring(0, (time_str.length-1)) + " "+val.planBJtime;
                    var times = Date.parse(new Date(train_job_time)) / 1000;//当前车次的时间戳
                    if(isToday(cur_year,cur_mon,curTimeStemp)){
                        if (Number(times) >= now_time) {
                            if(train_flow_id == ''){
                                train_flow_id = val.train_flow_id
                                get_right_mes(val.train_flow_id)
                            }
                        }
                    }

                    var _li = $('<li data-train-flow-id="'+val.train_flow_id+'"></li>'),
                    _pTime = $('<p class="times">'+val.planBJtime+'</p>'),
                    _pTrain = $('<p class="train">'+val.train_number+'</p>')
                    _pCurline=$('<div class="curline">\
                                    <span class="point"></span>\
                                    <div class="line"></div>\
                                </div>')
                    // 判断是接车任务还是发车任务
                    if (!val.begin) {
                        _li.append(_pTime)
                        _li.append(_pCurline)
                        _li.append(_pTrain)
                    }else{
                        _li.append(_pTrain)
                        _li.append(_pCurline)
                        _li.append(_pTime)
                    }
                    $(".train_list").append(_li)

                    if(val.nolate != null && val.nolate != undefined && !val.nolate){
                        _li.find('.point').css('background','#8a11f8')
                    }
                    if(val.is_open == '1'){
                        _li.find('.point').css('background',val.color)
                    }
                    if(_li.data('train-flow-id') == train_flow_id){
                        _li.addClass('hei_linght')
                        $(".train_list").scrollTop(_curids * 50)
                    }
                    _curids++
                } else {
                }
            })
            $(".train_time .lds-css").css("display", "none")
        }
    })
}
get_left_list({
    _: Math.random() * 100
})

// 点击左右按钮切换车次列表
function list_btn(direc) {
    var mon = $(".month").html(),
        cur_time = $(".year").html()
    for (var i = 0; i < mon.length; i++) {
        if (!isNaN(mon[i])) {
            cur_time += mon[i]
        }
    }
    get_left_list({
        time: cur_time,
        page: direc
    })
}
// 前一天车次列表
$(".left_arrow").on("click", function () {
    list_btn("last")
})
// 后一天车次列表
$(".right_arrow").on("click", function () {
    list_btn("next")
})
$(".icon-chahao").on("click", function () {
    $(".ipt input").val("")
})
// 点击搜索按钮
$(".search_train .search").on("click", function () {
    var train_num = $.trim($(".search_ipt").val().toUpperCase())
    // var _searchTxt=String($(this).find(".train").text()).toUpperCase();
    console.log(train_num)
    
    if (train_num) {
        $(".train_list li").each(function (i, val) {
            var _txt=String($(this).find(".train").text()).toUpperCase();
            //console.log(_txt.indexOf(train_num))
            if (_txt.indexOf(train_num) == -1) {
                $(this).css("display", "none")
            } else {
                $(this).css("display", "flex")
            }
        })
        /* 
            // var mon=$(".month").html(),
            // cur_time=$(".year").html()
            // // console.log(mon)
            // for(var i=0;i<mon.length;i++){
            //     if(!isNaN(mon[i])){
            //         cur_time+=mon[i]
            //     }
            // }
            // console.log(cur_time)
            // get_left_list({
            //     time:cur_time,
            //     name:train_num
            // })



            // $(".train_list li").remove()
            // $.each(lis,function(i,val){
            //     if(val.train_number==train_num){
            //         var li;
            //         if(val.begin){
            //             li=`<li>
            //                     <p class="times">${val.planBJtime}</p>
            //                     <div class="curline">
            //                         <span></span>
            //                         <div class="line"></div>
            //                     </div>
            //                     <p class="train">${val.train_number}</p>
            //                 </li>`

            //         }else{
            //             li=`<li>
            //                     <p class="train">${val.train_number}</p>
            //                     <div class="curline">
            //                         <span></span>
            //                         <div class="line"></div>
            //                     </div>
            //                     <p class="times">${val.planBJtime}</p>
            //                 </li>`
            //         }
            //         $(".train_list").append(li)
            //     }
            // })
            // $(".train").each(function(){

            //     if($(this).text()!=train_num){
            //         $(this).parent().remove()
            //     }
            // })
        */
    } else {
        get_left_list({
            _: Math.random() * 100
        })
    }
})


// 获取右侧数据
function get_right_mes(flowid) {
    var flowid = flowid;
    $.ajax({
        url:serverUrl.base+serverUrl.workTaskTrain+"getTrainTaskFlow",
        type: "post",
        dataType:'json',
        data: {
            flowid: flowid
        },
        beforeSend: function () {     //请求成功前触发的局部事件
            $(".job_right .lds-css").css("display", "block")
        },
        success: function (data) {
            var result = data.data,
                train_mes = result.result,
                job_list = result.list;
            // 全局变量
            cur_change_mes = train_mes
            $(".train_mes_list ul li").remove()
            $(".job_list .job_mes").remove()
            var li = `<li>
                    <p>车次 : </p>
                    <input type="text" value="${train_mes.train_number}" readonly>
                </li>
                <li></li>
                <li>
                    <p>始发站 : </p>
                    <input type="text" value="${train_mes.train_begin_station_name}" readonly>
                </li>
                <li>
                    <p>始发时间 : </p>
                    <input type="text" value="${train_mes.train_begin_time}" readonly>
                </li>
                <li>
                    <p>终点站 : </p>
                    <input type="text" value="${train_mes.train_end_station_name}" readonly>
                </li>
                <li>
                    <p>到达时间 : </p>
                    <input type="text" value="${train_mes.train_end_time}" readonly>
                </li>
                
                <li>
                    <p>列车停靠股道 : </p>
                    <input type="text" value="${train_mes.track_name}" readonly>
                </li>
                <li>
                    <p>作业站台 : </p>
                    <input type="text" value="${train_mes.platform_name}" readonly>
                </li>`
            $(".train_mes_list ul").append(li)            
            $.each(job_list, function (i, val) {
                    val.color = val.color || "#ccc"
                    val.user_name = val.user_name || '无'
                    var job_mes = `<div class="job_mes" style="background-color:${val.color}">
                                    <p>${val.task_name}</p>
                                    <p>任务状态 : <span style="">${val.stastr}</span></p>
                                    <p>作业人员 : <span>${val.user_name}</span></p>
                                </div>`
                $(".job_list").append(job_mes)
            })

            // train_flow_statu:1过期 3未过期   train_status:停运（2为停运）1为未停运
            if ((train_mes.train_flow_statu == '1' || train_mes.is_open == '1') && powers.operate_work_safe) {
                //is_open 是否点击开始作业 1点击了 0 没点击
                //不可以修改车次信息
                //点击了开始作业 或者 过期的车次都不能修改车次
                $(".change_mes").attr("disabled", true).css("background", "#ccc")
            } else {
                //可以修改车次信息
                $(".change_mes").attr("disabled", false).css("background", "#11a0f8")
            }
            if((train_mes.is_beinglate == '1' && train_mes.beinglate_time == '0') && train_mes.is_open == '0' && powers.operate_work_safe){
                $(".change_mes").attr("disabled", false).css("background", "#11a0f8")
            }
            if (train_mes.is_start && powers.operate_work_safe) {
                //可以开始
                $(".start_job").attr("disabled", false).css("background", "#11a0f8")

            } else {
                //不可以开始
                $(".start_job").attr("disabled", true).css("background", "#ccc")
            }
            $('.working_icon').css('display','inline-block')
            //is_done 该车次里面的作业任务是否完成了
             //获取当前日期和列表日期
             clearInterval(set_it)
             if(isToday($(".train_time .year").text(),$(".train_time .month").text()),curTimeStemp){
                if(train_mes.is_done){
                    $('.working_icon').css('display','none')
                }
                if (!train_mes.is_done && !train_mes.is_start) {
                    set_it = setInterval(function () {
                        set_interval()
                    }, 5000)
                }
             }else{
                $('.working_icon').css('display','none')
             }
            
        },
        complete:function(){
            $(".job_right .lds-css").css("display", "none")
        }

    })
}
// 定时刷新-右侧
function set_interval() {
    $.ajax({
        url: serverUrl.base+serverUrl.workTaskTrain+"getTrainTaskFlow",
        type:"post",
        dataType:"json",
        data: {
            flowid: train_flow_id
        },
        success: function (res) {
            if(res.code == '0'){
                
                var result = res.data,
                train_mes = result.result,
                job_list = result.list
                if(train_mes.train_flow_id != train_flow_id){
                   return false 
                }
                $(".job_list .job_mes").remove()
                $.each(job_list, function (i, val) {
                    var job,
                        color = "#ccc"
                        val.user_name = val.user_name || '无'
                        job_mes = `<div class="job_mes" style="background-color:${val.color}">
                                        <p>${val.task_name}</p>
                                        <p>任务状态 : <span style="">${val.stastr}</span></p>
                                        <p>作业人员 : <span>${val.user_name}</span></p>
                                    </div>`
                    $(".job_list").append(job_mes)
                })
                if(train_mes.is_done){
                    $('.working_icon').css('display','none')
                }
            }else{
                alert(res.info)
            }
            
        },
        complete:function(){

        }

    })
}
var is_alert=false,latingArr=[]
// 左侧
function updataLeftList(){
    if(isToday($('.year').text(),$('.month').text(),curTimeStemp)){
    $.ajax({
        url: serverUrl.base+serverUrl.workTaskTrain+"getTrainFlow",
        type: "post",
        dataType:'json',
        data: {_:Math.random()},
        beforeSend: function () {     //请求成功前触发的局部事件
            $(".train_time .lds-css").css("display", "block")
        },
        success: function (data) { 
            if(data.code == 1){
                $(".train_time .lds-css").css("display", "none");
                return false
            }          
            var result = data.data,
                time_arr = result.d,
                cur_year = result.y,//数据年
                cur_mon = result.m,//数据月日
                train_list = result.d,//数据列表
                now_time = result.nowtime || Date.parse(new Date()) / 1000,
                time_str = "";//后台给的时间

            for (var i = 0; i < cur_mon.length; i++) {
                if (isNaN(cur_mon[i])) {
                    time_str += "-"
                } else {
                    time_str += cur_mon[i]
                }
            }
            if($(".train_time .year").text() != cur_year || $(".train_time .month").text() != cur_mon){
                return false
            }
            var _curids=0;//列表中列车的index
            is_alert = false;
            $.each(train_list, function (i, val) {
                if ((typeof val) != "string") {
                    
                    var _li = $($(".train_list").find('li')[_curids])
                    if(_li.data('train-flow-id') != val.train_flow_id){
                        get_left_list({
                            _: Math.random() * 100
                        })
                        return false
                    }
                    // 控制point
                    var train_job_time = cur_year + "-" + time_str.substring(0, (time_str.length - 1)) + " "+val.planBJtime;
                    var times = Date.parse(new Date(train_job_time)) / 1000; //该车次的发车时间戳
                    if(val.nolate != null && val.nolate != undefined && !val.nolate){
                        _li.find('.point').css('background','#8a11f8')
                    }
                    if(val.is_open == '1'){
                        _li.find('.point').css('background',val.color)
                    }
                    //选中的li
                    _li.removeClass('hei_linght')
                    if(_li.data('train-flow-id') == train_flow_id){
                        _li.addClass('hei_linght')
                        if(times < now_time || val.is_open == '1'){
                            $(".start_job").attr("disabled", true).css("background", "#ccc")
                            $(".change_mes").attr("disabled", true).css("background", "#ccc")
                        }
                        if(val.is_beinglate == '1' && val.is_open == '0'){
                            $(".change_mes").attr("disabled", false).css("background", "#11a0f8")
                        }
                    }
                    //console.log(times-now_time <= 120,times-now_time >= 0)
                    if((val.status == 6 || val.status == 7) && val.is_open == '1' && (times-now_time <= 120) &&  (times-now_time >= 0)){
                        //未接收 进行中
                        var needAlert = latingArr.every(function(v){
                            return v != val.train_flow_id
                        })
                        if(needAlert){
                            is_alert = true;
                            _li.find('.point').addClass('animated infinite flash')
                            latingArr.push(val.train_flow_id) 
                        }
                    }else{
                        latingArr = latingArr.filter(function(v){
                            return v != val.train_flow_id
                        })
                        _li.find('.point').removeClass('animated infinite flash')
                    }
                    _curids ++
                } else {}
            })
            if(is_alert){
                $('.dingling')[0].play()
                setTimeout(function(){
                    $('.dingling')[0].pause()
                },10000)
            }
            $(".train_time .lds-css").css("display", "none")
        }
    })
    }
}
var time2=setInterval(function(){
    if(isToday($('.year').text(),$('.month').text(),curTimeStemp)){
        updataLeftList()
    }
},5000)
// 点击列车流水右侧查看详情
$(document).off('click.train_list_li').on('click.train_list_li','.train_list li',function (e) {
    var _id = $(this).data("train-flow-id")
    get_right_mes(_id)
    train_flow_id = _id
    $(this).addClass("hei_linght").siblings().removeClass("hei_linght")
})

// 开始作业任务
$(".start_job").on("click", function () {
    baseFn.dialog({
        title: '开启提示',
        content: '你要开启本车次的作业任务吗？',
        okValue: '开启',
        ok: function(){
            $(".start_job").attr("disabled", true).css("background", "#ccc")
            $(".change_mes").attr("disabled", true).css("background", "#ccc")
            $.ajax({
                url: serverUrl.base+serverUrl.workTaskTrain+"triggerTask",
                type: "post",
                dataType:'json',
                data: {
                    userid:sessionStorage.getItem('user_id'),
                    flowid: train_flow_id
                },
                success: function (res) {
                    if (res.code == '0') {
                        alert("执行作业任务成功")
                        set_interval()
                        updataLeftList()
                        clearInterval(time2)
                        time2 = setInterval(function(){
                            updataLeftList()
                        },5000)
                        $('.working_icon').css('display','inline-block')
                        clearInterval(set_it)
                        set_it = setInterval(function () {
                            set_interval()
                        }, 5000)
                    } else {
                        alert("该作业任务暂时无法执行")
                    }
                }
            })
        },
        cancel: function(){}
    })
    
})


// 添加临时车次(暂时不做)


// 修改车次信息    (返回数据报错==》返回data为空)

// $.ajax({
//     url:serverUrl.base+serverUrl.workTaskTrain+"UpdateTrainTaskFlow",
//     type:"post",
//     header:{
//         'Access-Control-Allow-Origin':"*"
//     },
//     data:{
//         flowid:"33197"
//     },
//     success:function(data){
//         var result=JSON.parse(data) 

//             console.log(result)

//     },

// })
var train_status = [{ id: 1, text: "正常" }, { id: 2, text: "停运" }],
    is_beinglate = [{ id: 0, text: "否" }, { id: 1, text: "是" }]
//select2 init()
function get_sel(url, sel_arr, el, cur_id) {
    $.ajax({
        url: url,
        data: {
            _: Math.random()
        },
        type: "post",
        header: {
            'Access-Control-Allow-Origin': "*"
        },
        beforeSend: function () {     //请求成功前触发的局部事件
            $(".lds-css").css("display", "block")
        },
        success: function (data) {
            var result = JSON.parse(data).data
            $.each(result, function (i, val) {
                var obj = {}
                obj.id = val.id
                obj.text = val.text
                sel_arr.push(obj)
            })
            $(el).select2({
                data: sel_arr,
                placeholder: '请选择'
            })
            // console.log(cur_id)
            // console.log(el)
            $(el).val(cur_id).trigger('change')
            
        },
        complete:function(){
            $(".lds-css").css("display", "none")
        }

    })
}
$(".change_mes").on("click", function () {
    $(".submit_mes").attr("disabled", false).css("background", "#54a1fd")
    $(".change_list").html("")
    var train_zt = [{ id: 0, text: "请选择" }],
        train_gd = [{ id: 0, text: "请选择" }]
    $(".job_safety_box").css("display", "none");
    $(".change_train_mes").css("display", "block");
    get_sel(serverUrl.base+serverUrl.taskTrain+"platform_list", train_zt, ".change_train_zt", cur_change_mes.platform_id)
    get_sel(serverUrl.base+serverUrl.taskTrain+"track_list", train_gd, ".change_train_gd", cur_change_mes.track_id)
    var lis = `<li>
                <div>
                    <p>车次 : </p>
                    <input type="text" value="${cur_change_mes.train_number}" class="sub_train_num" readonly>
                </div>
            </li>
            <li>
                <div>
                    <p>始发站 : </p>
                    <input type="text" value="${cur_change_mes.train_begin_station_name}" class="start_tname" readonly>
                </div>
                <div>
                    <p>始发时间 : </p>
                    <input type="text" value="${cur_change_mes.train_begin_time}" class="start_time" readonly>
                </div>
            </li>
            <li>
                <div>
                    <p>终点站 : </p>
                    <input type="text" value="${cur_change_mes.train_end_station_name}" class="end_tname" readonly>
                </div>
                <div>
                    <p>到达时间 : </p>
                    <input type="text" value="${cur_change_mes.train_end_time}" class="end_time" readonly>
                </div>
            </li>
            <li>
                <div>
                    <p>列车停靠股道 : </p>
                    <select class="c01-select change_train_gd"></select>
                </div>
                <div>
                    <p>作业站台 : </p>
                    <select class="c01-select change_train_zt"></select>
                </div>
            </li>
            <li>
                <div>
                    <p>列车状态 : </p>
                    <select class="c01-select train_status"></select>
                </div>
            </li>
            <li>
                <div>
                    <p>是否晚点 : </p>
                    <select class="c01-select is_beinglate"></select>
                </div>
            </li>
            <li>
                <div>
                    <p>晚点时间 : </p>
                    <input type="text" class="days" value="0"> 天 
                    <input type="text" class="hours" value="0"> 小时 
                    <input type="text" class="min" value="0"> 分钟 
                </div>
            </li>`

    $(".change_list").append(lis)
    $(".train_status").select2({
        data: train_status,
        placeholder: '请选择'
    })
    $(".is_beinglate").select2({
        data: is_beinglate,
        placeholder: '请选择'
    })
    // $(".nolatetime").select2({
    //     data: is_beinglate,
    //     placeholder: '请选择'
    // })
    $(".train_status").val(cur_change_mes.train_status).trigger('change')
    $(".is_beinglate").val(cur_change_mes.is_beinglate).trigger('change')
   // $(".nolatetime").val(cur_change_mes.nolatetime).trigger('change')
    $(".change_train_gd").on("select2:select", function () {
        var track_id = $(this).val()
        $.ajax({
            url: serverUrl.base+serverUrl.taskTrain+"relation",
            type: "post",
            header: {
                "Access-Control-Allow-Origin": "*"
            },
            data: {
                track_id: track_id
            },
            success: function (data) {
                var result = JSON.parse(data).data,
                    platform_id = result.platform_id

                $(".change_train_zt").val(platform_id).trigger('change')
            }
        })
    })

    $(".change_train_zt").on("select2:select", function () {
        var platform_id = $(this).val()
        $.ajax({
            // url: "http://"+server_url+":8081/Organization/train/relation",
            url: serverUrl.base+serverUrl.taskTrain+"relation",
            type: "post",
            header: {
                "Access-Control-Allow-Origin": "*"
            },
            data: {
                platform_id: platform_id
            },
            success: function (data) {
                var result = JSON.parse(data).data,
                    track_id = result.track_id

                $(".change_train_gd").val(track_id).trigger('change')
            }
        })
    })

})

// 提交修改信息
$(".submit_mes.subs").on("click", function () {
    $(this).attr("disabled", true).css("background", "#ccc")
    var sub_flowid = cur_change_mes.train_flow_id,
        sub_beginname = cur_change_mes.train_begin_station_id,
        sub_endname = cur_change_mes.train_end_station_id,
        sub_begintime = $(".start_time").val(),
        sub_endtime = $(".end_time").val(),
        sub_trackid = $('.change_train_gd').select2('data')[0].id,
        sub_platformid = $('.change_train_zt').select2('data')[0].id,
        sub_trainstatus = $('.train_status').select2('data')[0].id,
        sub_isbeinglate = $('.is_beinglate').select2('data')[0].id,
        //sub_nolatetime = $('.nolatetime').select2('data')[0].id,
        days = $(".days").val(),
        hours = $(".hours").val(),
        min = $(".min").val(),
        beinglatetime = 0
    if(sub_isbeinglate == '1'){
        if (!isNaN(days)) {

            beinglatetime += days * 24 * 60 * 60
    
        } else {
            alert("晚点时间请输入数字")
            return false;
        }
        if (!isNaN(hours)) {
            beinglatetime += hours * 60 * 60
    
        } else {
            alert("晚点时间请输入数字")
            return false;
        }
        if (!isNaN(min)) {
            beinglatetime += min * 60
    
        } else {
            alert("晚点时间请输入数字")
            return false;
        }
    }
    if(sub_platformid == '' || sub_platformid == null || sub_platformid == undefined){
        alert("站台不能为空")
        return false
    }
    //console.log(beinglatetime)
    if(sub_trainstatus == '2'){
        train_flow_id = ''
    }
    // console.log(sub_flowid,sub_beginname,sub_endname,sub_begintime,sub_endtime,sub_trackid,sub_platformid,sub_trainstatus,sub_isbeinglate)
    $.ajax({
        url: serverUrl.base+serverUrl.workTaskTrain+"UpdateTrainTaskFlow",
        type: "post",
        dataType:'json',
        data: {
            flowid: sub_flowid,
            beginname: sub_beginname,
            endname: sub_endname,
            begintime: sub_begintime,
            endtime: sub_endtime,
            trackid: sub_trackid,
            platformid: sub_platformid,
            trainstatus: sub_trainstatus,
            isbeinglate: sub_isbeinglate,
            beinglatetime: beinglatetime
        },
        success: function (data) {
            var info = data.info
            if (info == "成功") {
                alert("信息修改成功")
                get_left_list({
                    _: Math.random() * 100
                })
                get_right_mes(train_flow_id)
                $(".job_safety_box").css("display", "block");
                $(".change_train_mes").css("display", "none");
            } else {
                alert("信息修改失败")
                $(".submit_mes").attr("disabled", false).css("background", "#54a1fd")
            }
        }


    })
})


$(".back_jobsafety").on("click", function () {
    $(".job_safety_box").css("display", "block");
    $(".change_train_mes").css("display", "none");
})
$(".submit_mes.cancel").on("click", function () {
    $(".job_safety_box").css("display", "block");
    $(".change_train_mes").css("display", "none");
})


